home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Atari Mega Archive 1
/
Atari Mega Archive - Volume 1.iso
/
ste
/
50play.lzh
/
PR50TTP6.S
< prev
next >
Wrap
Text File
|
1992-11-28
|
54KB
|
2,429 lines
;-----------------------------------------------------------------------;
; ;
; TTP .MOD Player ;
; 7 Bit Ste/TT Pro-Tracker 2.1A Driver ;
; (C) October/November 1992 Griff of Electronic Images ;
; ;
; - 50 khz stereo sound, with microwire control. ;
; - The ONLY player in the whole wide world to emulate TEMPO properly. ;
; - SEE DOC file for furthur info. ;
;-----------------------------------------------------------------------;
; Quick notes about this source. ;
; - Assemble using DEVPAC 2 or 3. ;
; - This replay is NOT fast and nor should it be. ;
; - It is designed for QUALITY and ACCURATE replay of ProTracker MODS. ;
; - It doe NOT pad samples and so doesn't waste any setup time/memory. ;
; - If you use it, then please credit me. ;
;-----------------------------------------------------------------------;
test EQU 0 ; if test=1 then run from assember
; (with a pre-included module)
bufsize EQU 5500 ; maximum size of buffer
; (when tempo =32)
dmamask EQU %00000011 ; STE dmamask for 50khz
OPT O+,OW-
letsgo
IFEQ test
MOVEA.L 4(A7),A5
LEA $80(A5),A5 ; -> length,filename
ELSEIF
LEA testfile,A5 ; if in testmode
ENDC ; then -> testfilename
MOVE.B (A5)+,D0 ; get filename length.
BEQ mustinstall ; no filename given?
LEA filename(PC),A4
.lp MOVE.B (A5)+,(A4)+
SUBQ.B #1,D0
BNE.S .lp
CLR.B (A4) ; terminate filename
MOVE.L 4(SP),A5
MOVE.L $C(A5),A4
ADD.L $14(A5),A4
ADD.L $1C(A5),A4
LEA $100(A4),A4 ; proggy size+basepage
PEA (A4)
PEA (A5)
CLR -(SP)
MOVE #$4A,-(SP)
TRAP #1 ; reserve some memory
LEA 12(SP),SP
CLR.L -(SP)
MOVE #$20,-(SP)
TRAP #1 ; supervisor mode
ADDQ.L #6,SP
MOVE.L D0,oldsp
MOVE.L USP,A0
MOVE.L A0,oldusp ; save user stack ptr.
LEA my_stack,SP ; our own stack.
DC.W $A00A ; hide mouse
BSR set_screen ; setup the screen
BSR SoundTest ; check for dma sound
TST.L D1 ; if this is an old ST
BEQ wrongST_error ; then quit out!
MOVE #$777,D7 ;;; in future
.fadedownfirst BSR Wait_Vbl ;;; will use o.s
BSR Wait_Vbl ;;; set colour.
MOVE.W D7,$FFFF8240.W
SUB #$111,D7
BGE.S .fadedownfirst
MOVE.L #$00000777,$FFFF8240.W ;;;
MOVE.L #$00000777,$FFFF8244.W ;;;
BSR load_mod ; load the module
TST.B errorflag
BNE load_error ; exit if load error
BSR print_mainscr ; print main screen
BSR set_microwire ; setup micrwire
BSR Wait_Vbl
.goformusic BSR init_ints ; and kill ints
MOVEQ #1,D0
MOVEQ #0,D1
BSR Init_ST ; install music
; Music playing, key selection loop follows(microwire control)
.waitk BSR Wait_VblNG
BSR Wait_VblNG
BSR Wait_VblNG
BSR print_tempo
BSR microwire_cont ; microwire keyboard control
MOVE.B key(PC),D0
CMP.B #$14+$80,D0 ; t pressed and released?
BNE.S .nottempo
BSR toggle_tempo ; yes then toggle tempo
CLR.B key
.nottempo CMP.B #$39+$80,D0 ; space exits.
BNE .waitk
BSR stop_music
BSR restore_ints ; restore gem..
exit BSR restore_screen
exitloaderr DC.W $A009
MOVE.L oldsp(PC),-(SP)
MOVE #$20,-(SP)
TRAP #1 ; user mode
ADDQ.L #6,SP
redir PEA dummy(PC)
MOVE.W #$4e,-(SP)
TRAP #1
ADDQ.L #6,SP
CLR.W -(SP) ; Get dir.
PEA dir
MOVE.W #$47,-(SP)
TRAP #1
ADDQ.L #8,SP
CLR -(SP)
TRAP #1
;-------------------------------------------------------------------------
; A few error handlers.
; NO DMA Sound so can't use this player.
wrongST_error PEA wrongST_err_txt(PC)
MOVE.W #9,-(SP)
TRAP #1
ADDQ.L #6,SP
MOVE.W #7,-(SP)
TRAP #1
ADDQ.L #2,SP
BRA exit
load_error BSR restore_screen
CMP.L #-33,error_no
BNE.S .not_fnf
PEA filenf_errortxt(PC)
BRA.S .cont
.not_fnf PEA load_errortxt(PC)
.cont MOVE.W #9,-(SP)
TRAP #1
ADDQ.L #6,SP
MOVE.W #7,-(SP)
TRAP #1
ADDQ.L #2,SP
BRA exitloaderr
; No FILENAME was passed error - so tell 'em how to install !!
mustinstall DC.W $A00A
PEA installtxt(PC)
MOVE.W #9,-(SP)
TRAP #1
ADDQ.L #6,SP
MOVE.W #7,-(SP)
TRAP #1
ADDQ.L #2,SP
DC.W $A009
BRA.S redir
installtxt DC.B 27,"E"
DC.B "You must install this program as an",10,13
DC.B "application on the Gem desktop,",10,13
DC.B "OR Type the Module Name if you are",10,13
DC.B "running this from a command line!",10,13
DC.B "Press any key.",10,13,0
load_errortxt DC.B 27,"E"
DC.B "Load Error(disk error?)",10,13
DC.B "Press any key.",10,13,0
filenf_errortxt DC.B 27,"E"
DC.B "File Not Found",10,13
DC.B "Press any key.",10,13,0
wrongST_err_txt DC.B 27,"E"
DC.B "You must have an Ste,Mega Ste or TT",10,13
DC.B "to run this module player..(sorry!)",10,13
DC.B "Press any key.",10,13,0
EVEN
;-------------------------------------------------------------------------
; Subroutines for interrupts and replay.
; Save mfp vectors and ints and install our own.(very 'clean' setup rout)
init_ints MOVEQ #$13,D0 ; pause keyboard
BSR Writeikbd ; (stop from sending)
MOVE #$2700,SR
LEA old_stuff+32(PC),A0
MOVE.B $FFFFFA07.W,(A0)+
MOVE.B $FFFFFA09.W,(A0)+
MOVE.B $FFFFFA13.W,(A0)+
MOVE.B $FFFFFA15.W,(A0)+ ; Save mfp registers
MOVE.B $FFFFFA19.W,(A0)+
MOVE.B $FFFFFA1F.W,(A0)+
MOVE.L $70.W,(A0)+
MOVE.L $B0.W,(A0)+
MOVE.L $118.W,(A0)+
MOVE.L $134.W,(A0)+
CLR.B $fffffa07.W
MOVE.B #$40,$fffffa09.W
CLR.B $fffffa13.W
MOVE.B #$40,$fffffa15.W
BCLR.B #3,$fffffa17.W ; software end of int.
LEA my_vbl(PC),A0
MOVE.L A0,$70.W ; set our vbl
LEA key_rout(PC),A0
MOVE.L A0,$118.W ; and our keyrout.
LEA supers(PC),A0
MOVE.L A0,$B0.W
CLR key
MOVE #$2300,SR
MOVEQ #$11,D0 ; resume sending
BSR Writeikbd
MOVEQ #$12,D0 ; kill mouse
BSR Writeikbd
BSR flush
RTS
supers BCHG #13-8,(SP) ; toggle super
RTE
; Restore mfp vectors and ints.
restore_ints MOVE.L oldusp(PC),A0
MOVE.L A0,USP
MOVEQ #$13,D0 ; pause keyboard
BSR Writeikbd ; (stop from sending)
MOVE #$2700,SR
LEA old_stuff+32(PC),A0
MOVE.B (A0)+,$FFFFFA07.W
MOVE.B (A0)+,$FFFFFA09.W
MOVE.B (A0)+,$FFFFFA13.W
MOVE.B (A0)+,$FFFFFA15.W ; restore mfp
MOVE.B (A0)+,$FFFFFA19.W
MOVE.B (A0)+,$FFFFFA1F.W
MOVE.L (A0)+,$70.W
MOVE.L (A0)+,$B0.W
MOVE.L (A0)+,$118.W
MOVE.L (A0)+,$134.W
BSET.B #3,$FFFFFA17.W
MOVE #$2300,SR
MOVEQ #$11,D0 ; resume
BSR Writeikbd
MOVEQ #$8,D0 ; restore mouse.
BSR Writeikbd
BSR flush
RTS
;--------------------------------------------------------------------------
; CookieJar Check to see if we have DMA sound.(i.e STE/TT)
; Return D1=0 if DMA sound is not available on this machine. (else d1=-1)
;--------------------------------------------------------------------------
SoundTest move.l $5A0.W,d0 ; get cookie jar ptr
beq.s no_dmasnd ;; nul ptr = no cookie jar
move.l d0,a0 ;; (no cookie jar= no dma snd)
.search_next tst.l (a0)
beq.s no_dmasnd
cmp.l #'_SND',(a0) ; cookie found?
beq.s .search_found
addq.l #8,a0
bra.s .search_next
.search_found move.l 4(a0),d0 ; get _SND const.
cmp.l #3,D0
blt.s no_dmasnd
moveq #-1,d1 ; DMA SOUND FOUND!
rts
no_dmasnd moveq #0,d1 ; NO DMA SOUND!
rts
; Wait for a vbl..
Wait_Vbl MOVE #37,-(SP)
TRAP #14
ADDQ.L #2,SP
RTS
; Wait for a vbl,(Not Gems..)
Wait_VblNG MOVE.W vbl_timer(PC),D0
.waitvb CMP.W vbl_timer(PC),D0
BEQ.S .waitvb
RTS
old_stuff: DS.L 18
oldres DS.W 1
oldsp DS.L 1
oldusp DS.L 1
; Flush IKBD
flush BTST.B #0,$FFFFFC00.W ; any waiting?
BEQ.S .flok ; exit if none waiting.
MOVE.B $FFFFFC02.W,D0 ; get next in queue
BRA.S flush ; and continue
.flok RTS
; Write d0 to IKBD
Writeikbd BTST.B #1,$FFFFFC00.W
BEQ.S Writeikbd ; wait for ready
MOVE.B D0,$FFFFFC02.W ; and send...
RTS
; Keyboard handler interrupt routine...
; (crap)
key_rout PEA (A0)
MOVE D0,-(SP)
MOVE.B $FFFFFC00.W,D0
BTST #7,D0 ; int req?